package io.babystar.modules.business.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.babystar.common.utils.PageUtils;
import io.babystar.common.utils.Query;
import io.babystar.modules.business.dao.CWCategoryDao;
import io.babystar.modules.business.entity.CWCategoryEntity;
import io.babystar.modules.business.service.CWCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("cwCategoryService")
public class CWCategoryServiceImpl extends ServiceImpl<CWCategoryDao, CWCategoryEntity> implements CWCategoryService {
    @Autowired
    CWCategoryDao cwCategoryDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CWCategoryEntity> page = this.page(
                new Query<CWCategoryEntity>().getPage(params),
                new QueryWrapper<CWCategoryEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<Integer> queryPidList(Integer parentId) {
        return cwCategoryDao.queryPidList(parentId);
    }

}